<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    class Person {
        constructor(name) {
            this.name = name;
        }
        drink () {
            console.log("喝水");
        }
    }

    class Student extends Person {
        constructor(name,score) {
            super(name);
            this.score = score
        }
        introduce() {
            console.log(`我是${this.name},考了${this.score}分`)
        }
    }
    const student = new Student("张三",99)
    console.log("student",student)
    student.introduce();
    student.drink();

    class Teacher extends Person{
        constructor(name,subject) {
            super(name);
            this.subject = subject;
        }
        teach() {
            console.log(`我是${this.name},教${this.subject}`)
        }
    }
    const teacher = new Teacher("哈默","前端");
    console.log("teacher",teacher)
    teacher.teach();
    student.drink();


</script>
</body>
</html>
